package com.hlx.service.admin.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hlx.entity.admin.Train;
import com.hlx.mapper.admin.TrainMapper;
import com.hlx.service.admin.TrainService;
import org.springframework.stereotype.Service;

@Service
public class TrainServiceImpl extends ServiceImpl<TrainMapper, Train> implements TrainService {
    @Override
    public Integer getTrainVelocity(String trainName) {
        LambdaQueryWrapper<Train> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Train::getTrainName,trainName);
        return this.getOne(queryWrapper).getTrainVelocity();
    }

    @Override
    public Train getTrainByTrainName(String trainName) {
        LambdaQueryWrapper<Train> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Train::getTrainName,trainName);
        return this.getOne(queryWrapper);
    }
}
